package com.hs.mobile.service.service;

import java.util.List;

import com.hs.mobile.model.Device;
import com.hs.mobile.model.ServiceMB;
import com.hs.mobile.dao.service.ServiceDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("serviceService")
public class ServicesMBServiceImpl implements ServicesMBService {

	@Autowired
	ServiceDAO serviceDAO;	
	/**
	 * @name setterCategoryDAO
	 * @param serviceDAO
	 */
	public void setServiceDAO( ServiceDAO serviceDAO )
	{
		this.serviceDAO = serviceDAO;
	}
	/**
	 * 
	 * @return serviceDAO
	 */
	public ServiceDAO getServiceDAO()
	{
		return serviceDAO;
	}
	
	@Override
	public void save(ServiceMB services) {
		// TODO Auto-generated method stub
		System.out.println("__ save service __");
		serviceDAO.add(services);
	}

	@Override
	public void update(ServiceMB services) {
		// TODO Auto-generated method stub
		System.out.println("__ update service __");
		serviceDAO.update(services);
	}

	@Override
	public void delete(long id) {
		// TODO Auto-generated method stub
		System.out.println("__ delete __");
		ServiceMB delService = (ServiceMB) findServiceById(id);
		serviceDAO.delete(delService);
	}

	@Override
	public ServiceMB findServiceById(long id) {
		// TODO Auto-generated method stub
		System.out.println("__ find Service __");
		ServiceMB service = (ServiceMB) serviceDAO.findServiceById(id);
		return service;
	}

	@Override
	public List<ServiceMB> getAllServices() {
		// TODO Auto-generated method stub
		System.out.println("__ get list services __");
		List<ServiceMB> listServices = serviceDAO.getListAll();
		return listServices;
	}
	@Override
	public List<Device> getListDeviceByCategoryId(long categoryId) {
		// TODO Auto-generated method stub
		return serviceDAO.getListDevices(categoryId);
	}
}
